package com.ssh.dao.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;

import com.ssh.dao.CommodityDao;
import com.ssh.entity.Commodity;

@Repository
public class CommodityDaoImpl implements CommodityDao {
	@Autowired
	private HibernateTemplate ht;

	/**
	 * 执行HQL语句
	 */

	@SuppressWarnings("unchecked")
	public Commodity showCommdityByName(String commodityName) {
		List<Commodity> list = ht.find(" from Commodity where name=? ",commodityName);
		if(null != list && list.size() > 0) {
			return list.get(0);
		}
		return null;
	}


}
